<template>
  <NavBar @submit="submit"></NavBar>
  <br>
  <el-card>
    <template #header>列表</template>
    <el-table :data="list">
      <el-table-column label="时间" >
        <template #default="scope">
          {{dayjs(scope.row.时间).format('YYYY-MM-DD')}}
        </template>
      </el-table-column>
      <el-table-column label="项目收费代码" prop="项目院内代码"></el-table-column>
      <el-table-column label="数量" prop="数量"></el-table-column>
      <el-table-column label="单位" prop="单位"></el-table-column>
      <el-table-column label="开单科室" prop="开单科室"></el-table-column>
      <el-table-column label="执行科室" prop="执行科室"></el-table-column>
      <el-table-column label="金额" prop="金额"></el-table-column>
    </el-table>
    <br>
    <div class="pagin">
      <el-pagination background layout="prev, pager, next,jumper" :total="total" @current-change="search" />
    </div>
  </el-card>
</template>

<script setup>
import { dayjs } from 'element-plus'
import NavBar from '@/components/navBar/Index.vue'
import {ref} from "vue";
import { getBenefitLis } from '@/api/Benefit.js'

const list = ref([])
const listInfo = ref({
  page:1,
  limit:10,
  startTime:'1609459200000',
  endTime:new Date().getTime()
})
const total = ref(0)

const search = async (page=1) => {
  listInfo.value.page=page
  const res = await getBenefitLis(listInfo.value)
  total.value = res.count
  list.value = res.data
}
search()
const submit = (from) => {
  listInfo.value = {
    page:1,
    limit:10,
    startTime:'1609459200000',
    endTime:new Date().getTime()
  }
  listInfo.value = {...listInfo.value,...from}
  search()
}
</script>

<style scoped lang="less">
.pagin{
  display: flex;
  justify-content: center;
}
</style>